interface Flyable {
    void fly();
}
class Bird implements Flyable {
    private int altitude;//飞行高度
    private int speed;//飞行速度
    public Bird(int alt, int spd) {
        this.altitude = alt;
        this.speed = spd;
    }
    @Override
    public void fly() {
        System.out.println("鸟在" + altitude + "米的高度以" + speed + "km/h的时速飞行。");
    }
    public void adjust(int newAltitude, int newSpeed) {
        this.altitude = newAltitude;
        this.speed = newSpeed;
    }
}
class Plane implements Flyable {
    private int passengerCapacity;//载客量
    private int range;//航程
    public Plane(int capacity, int r) {
        this.passengerCapacity = capacity;
        this.range = r;
    }
    @Override
    public void fly() {
        System.out.println("飞机载着" + passengerCapacity + "名乘客飞行了" + range + "km。");
    }
    public void adjust(int newCapacity, int newRange) {
        this.passengerCapacity = newCapacity;
        this.range = newRange;
    }
}
class Drone implements Flyable {
    private int batteryLife;//续航时间
    private boolean hasCamera;//是否有拍摄功能
    public Drone(int battery, boolean camera) {
        this.batteryLife = battery;
        this.hasCamera = camera;
    }
    @Override
    public void fly() {
        System.out.println("无人机的续航是" + batteryLife + "分钟。" + (hasCamera ? "有拍摄功能。" : "无拍摄功能"));
    }
    public void adjust(int newBattery, boolean newCamera) {
        this.batteryLife = newBattery;
        this.hasCamera = newCamera;
    }
}
class Superman implements Flyable {
    @Override
    public void fly() {
        System.out.println("超人正在飞！");
    }
    public void transform() {
        System.out.println("超人正在变身！");
    }
}
class Main {
    public static void main(String[] args) {
        //创建对象
        Bird bird = new Bird(1000, 80);//高度1000米，速度80 km/h
        Plane plane = new Plane(200, 5000);//载客量200人，航程5000km
        Drone drone = new Drone(30, true);//续航时间30分钟，有相机
        Superman superman = new Superman();
        //测试飞行功能
        bird.fly();
        plane.fly();
        drone.fly();
        superman.fly();
        //测试超人变身
        superman.transform();
        //调整飞行参数
        bird.adjust(1500, 90);//调整鸟的飞行高度和速度
        plane.adjust(300, 6000);//调整飞机的载客量和航程
        drone.adjust(40, false);//调整无人机的续航时间和相机功能
        //再次测试
        bird.fly();
        plane.fly();
        drone.fly();
    }
}
